package com.wkbb.common.dto.basic;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wkbb.common.enums.RelationTypeEnum;
import com.wkbb.common.utils.StringUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * @author dengjingyuan
 * @date 2019-07-04 20:17
 */
@Data
public class FamilyInfoDto implements Serializable {

    @ApiModelProperty(value = "编号")
    private Long id;

    @ApiModelProperty(value = "组织ID")
    private Long orgId;

    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @ApiModelProperty(value = "姓名")
    private String name;

    @ApiModelProperty(value = "昵称")
    private String nickName;

    @ApiModelProperty(value = "姓名读音")
    private String speakName;

    @ApiModelProperty(value = "头像url")
    private String headImgUrl;

    @ApiModelProperty(value = "性别")
    private String sex;

    @ApiModelProperty(value = "民族")
    private String nationality;

    @ApiModelProperty(value = "家长手机")
    private String mobile;

    @ApiModelProperty(value = "家长卡号")
    private String cardNo;

    @ApiModelProperty(value = "用户编号")
    private String userCode;

    @ApiModelProperty(value = "学生用户ID")
    private Long studentUserId;

    @ApiModelProperty(value = "学生姓名")
    private String studentName;

    @ApiModelProperty(value = "学生身份证")
    private String studentIdCard;

    @ApiModelProperty(value = "关系类型(1爸爸 2妈妈 3爷爷4奶奶 5姥爷 6姥姥7亲友 8其他)")
    private Integer relationType;

    @ApiModelProperty(value = "称呼")
    private String relationTypeName;

    @ApiModelProperty(value = "学生卡号")
    private String studentCardNo;

    @ApiModelProperty(value = "身份证号")
    private String idcard;

    @ApiModelProperty(value = "年级")
    private Long gradeId;

    @ApiModelProperty(value = "班级ID")
    private Long classId;

    @ApiModelProperty(value = "班级名称")
    private String className;

    //生日
    @ApiModelProperty(value = "生日")
    @JSONField(format = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birthDate;

    @ApiModelProperty(value = "省份CODE")
    private String provinceCode;

    @ApiModelProperty(value = "省份")
    private String province;

    @ApiModelProperty(value = "城市CODE")
    private String cityCode;

    @ApiModelProperty(value = "城市")
    private String city;

    @ApiModelProperty(value = "区镇CODE")
    private String areaCode;

    @ApiModelProperty(value = "区镇")
    private String area;

    //地址
    @ApiModelProperty(value = "地址")
    private String addr;

    @ApiModelProperty(value = "显示通讯录（0否 1是）")
    private Boolean showAddressBook;

    @ApiModelProperty(value = "状态")
    private Boolean status;

    @ApiModelProperty(value = "智慧校园用户ID")
    private String smartUserId;

    @ApiModelProperty(value = "智慧校园用户微信ID")
    private String smartWxUserId;

    @ApiModelProperty(value = "是否已关注智慧校园公众号1是0否")
    private Boolean isSmartSubscribe;

    @ApiModelProperty(value = "是否已经上传人脸")
    private Boolean hasUploadFace = false;

    @ApiModelProperty(value = "账号ID")
    private Long accountId;

    @ApiModelProperty(value = "人脸录入时间")
    private String createTime;

    @ApiModelProperty(value = "智慧校园学生用户ID")
    private String studentSmartUserId;

    @ApiModelProperty(value = "智慧校园家长用户ID")
    private String familySmartUserId;

    @ApiModelProperty(value = "人脸开关 0：关闭 1：开启 默认关闭")
    private Boolean faceFlag;

    @ApiModelProperty(value = "unionId")
    private String unionId;

    @ApiModelProperty(value = "备注")
    private String remark;

    public String getRelationTypeName() {
        if(StringUtil.isNotEmpty(relationTypeName)){
            return relationTypeName;
        }else {
            if (relationType == null) {
                return null;
            }
            return RelationTypeEnum.getDesc(this.relationType);
        }
    }
}
